/*
 * @lc app=leetcode.cn id=1732 lang=typescript
 *
 * [1732] 找到最高海拔
 */

// @lc code=start
function largestAltitude(gain: number[]): number {
    let now = 0;
    let max = 0;
    for (const iterator of gain) {
        now += iterator;
        max = Math.max(max, now);
    }
    return max;
}
// @lc code=end
